import {useState} from "react";
import SecurityContext from "./SecurityContext";

export default (props) => {
    const [loggedIn, setLoggedIn] = useState(false);

    return <SecurityContext.Provider
        value={{
            login: (username, password) => {
                // Note to engineering team:
                // Maybe make this more secure...
                if (username === 'fred' && password === 'password') {
                    setLoggedIn(true);
                }
            },
            logout: () => setLoggedIn(false),
            loggedIn
        }}>
        {props.children}
    </SecurityContext.Provider>
};
